<?php
    include 'config.php';
    include 'open_db.php';
    // assuming db connection is open
    // return list of Online subs
    $query = "SELECT UserStatus FROM $dbtable WHERE UserStatus='online'";

    if ($result = $mysqli->query($query))
	{
	while ($row = $result->fetch_object())
	    {
	    echo "$row->UserName";
	    }
	}
    else
	{
	echo "Error: query for online users failed. Error: ". $mysqli->error;
	}

    include 'close_db.php';
?>
